package mysql

import (
	"GoStart/e_mock"
	"context"
	"gorm.io/gorm"
)

type User struct {
	db *gorm.DB
}

func NewUser(db *gorm.DB) *User {
	return &User{db: db}
}

func (u User) GetUserByMobile(ctx context.Context, mobile string) (*e_mock.User, error) {
	var user e_mock.User
	_ = u.db.Where(&e_mock.User{Mobile: mobile}).First(&user)
	return &user, nil
}

var _ e_mock.UserData = &User{}
